App::ShaderToy - OpenGL Display in Perl

Max Maischein

Frankfurt.pm

DISCLAIMER

There are lots of pretty pictures and animations in this talk

They have all been programmatically generated

But not by me

App::ShaderToy - OpenGL Display in Perl

  • Push the boundaries

  • Real-Time Graphics

Accessing OpenGL from Perl

  • Let OpenGL do all the work

  • Send GLSL program to graphics card

  • Set up variables+values

  • Watch pretty pictures

Sample GLSL program

 1:  void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
 2:  vec2 uv = fragCoord.xy / iResolution.xy;
 3:    fragColor = vec4(uv,0.5+0.5*sin(iGlobalTime),1.0);
 4:  }
 5:  void main() {
 6:    vec4 color = vec4(0.0,0.0,0.0,1.0);
 7:    mainImage( color, gl_FragCoord.xy );
 8:    gl_FragColor = color;
 9:  }

App::ShaderToy

  • Fragment shader live editor

  • Based on an idea by Inigo Quilez and Pol Jeremias

  • https://www.shadertoy.com

  • But in Perl

  • Prima, Prima::OpenGL, OpenGL::Modern

Live Demo

See here ->

Installing App::Shadertoy

Not yet on CPAN

 1:    git clone https://github.com/Corion/app-shadertoy.git
 2:    cd app-shadertoy
 3:    cpanm --installdeps .
 4:    perl Makefile.PL
 5:    make
 6:    perl -Mblib -w scripts/shadertoy.pl -c shaders/demo.yml

Thanks

Thank you!

App::ShaderToy - https://github.com/Corion/app-shadertoy

corion@cpan.org

Slides will be at https://corion.net/talks/